1. Overview
The Clearing File is a central document within the Clearing module designed to manage and track the entire import or export clearing process for a specific shipment. It serves as a digital folder, linking all relevant details, documents, and related processes, providing a comprehensive overview of the clearing workflow. By consolidating this information, the Clearing File aims to streamline communication, improve efficiency, and reduce errors associated with manual tracking and disparate data sources.
2. Key Features
- Centralized Information: Stores all essential details about a shipment, including consignee/customer, shipper, mode of transport, key dates (arrival, departure), cargo details, and more.
- Automated Document Linking: Facilitates the attachment and organization of all necessary clearing documents (e.g., invoices, packing lists, permits, customs declarations).
- Status Tracking: Provides a clear visual representation of the current status of the clearing process (e.g., Open, Pre-Lodged, On Process, Cleared, Delivered).
- Automated Related Document Creation: Enables the easy creation and linking of downstream documents like TRA Clearance, Shipping Line Clearance, Physical Verification, and Port Clearance directly from the Clearing File.
- Address Retrieval: Automatically fetches and displays the consignee/customer address based on the linked Customer record.
- Cargo Description Summary: Automatically compiles a summary of the cargo descriptions from the linked Cargo Details table.
- Customizable Document Attachment: Allows users to attach documents with specific document types and associated attributes, ensuring proper categorization and data capture.
- Dashboard Integration: Provides insights and quick access to related clearance processes and attached documents within the Clearing File form.
- Workflow Automation (Backend): Includes backend scripts to automate status updates based on related document submissions and enforce mandatory document attachments before submission.
- Clearing Charge Validation (Backend): Integrates with Clearing Charges to ensure accuracy and completeness of financial aspects before final submission.
3. Pre-Requisites
Before using the Clearing File, ensure the following master data and configurations are in place:
- Customer Master: Ensure all consignees/customers are created in the Customer doctype.
- Address Master: Ensure relevant addresses for customers and other parties are created in the Address doctype.
- Mode of Transport Master: Define all applicable modes of transport (e.g., Sea, Air, Road) in the Mode of Transport doctype.
- Shipping Line Master (for Sea transport): Ensure all shipping lines are created.
- Airline Master (for Air transport): Ensure all airlines are created.
- Shipper Master: Ensure all shippers are created in the Shipper doctype.
- Clearing Document Type Master: Define all types of clearing documents required (e.g., Invoice, Packing List, Bill of Lading) and link them to the "Clearing File" doctype, specifying mandatory attributes if needed.
- Clearing Document Attribute Master: Define the attributes associated with different Clearing Document Types (e.g., Invoice Number, BL Number, Permit Expiry Date).
- User Roles and Permissions: Ensure users have the necessary roles and permissions to access and modify the Clearing File and related doctypes (refer to Section 7).
4. Step-by-Step Usage
Creating a New Clearing File:
Navigate to the Clearing module.
Click on "New" under the "Clearing File" section.
The system will automatically generate a unique "Name" based on the defined naming series (e.g., CF-2025-0001)
4.1 Details Tab:
Posting Date: The date of creating the Clearing File (defaults to today).
Company: Select the relevant company.
Consignee/ Customer: Link the appropriate Customer record. The "Consignee Address" will be automatically fetched and displayed. You can also manually select a specific customer address if needed.
Clearing Company: This field may be auto-filled based on the linked customer or can be manually entered if applicable.
Status: The initial status will be "Open". This will be automatically updated as the process progresses.

#####4.2 Shipment Details Tab:
Shipment Type: Select either "Import" or "Export".
Mode of Transport: Select the relevant mode of transport (e.g., Sea, Air, Road). Based on the "Mode of Transport," additional fields like "Shipping line," "Shipping Vessel Number," "Airline," and "Airplane Number" may appear. Fill these in as required.
Arrival Date (ETA): Enter the estimated date of arrival.
Departure Date: Enter the actual or estimated departure date.
B/L Status: Select the status of the Bill of Lading (e.g., Original B/L, Seaway Bill).
Shipper: Link the relevant Shipper record.
Cargo Country of Origin: Select the country where the cargo originated.

#####4.3 Cargo Details Tab:
Add details of the cargo by clicking "Add Row" in the "Cargo Details" table.
For each item, enter the "Package Type" (e.g., Container, Loose), "Quantity," "Unit," and a detailed "Cargo Description."
If the "Package Type" is "Container," you will need to enter the "Container Number" and "Seal Number." These fields will be hidden if "Loose" is selected.

- The "Cargo Description Summary" field will be automatically populated based on the entries in the "Cargo Details" table.
Cargo Details
#####4.4 Additional Information :
Add any general notes related to the clearing process.
#####4.5 Special Instructions:
Include any specific instructions for handling the clearing.

- Click "Save" to create the Clearing File.
#####4.6 Attaching Documents:
Once the Clearing File is saved, you will see an "Attach Documents" button in the "Document Section." Click this button.
A dialog box titled "Attach Clearing Document" will appear.
Document Type: Select the type of document you are attaching (e.g., Invoice, Packing List). The list of available document types is filtered based on those linked to the "Clearing File" in the system configuration.
Upon selecting a "Document Type," the "Document Attributes" table below will dynamically display any mandatory or optional attributes associated with that document type (as configured in the "Clearing Document Type" master).
Fill in the "Value" for each displayed attribute. Mandatory attributes must be filled before submitting the attachment.
Attach Document: Click the "Attach" button to upload the document from your local machine.

Click "Submit" to save the attached document and its attributes to the Clearing File. The attached document will appear in the "Document" table within the "Document Section."
Repeat this process for all necessary clearing documents.
In essence, the "Physical Verification Document" DocType is designed to store information about specific documents related to a clearing process. Each record in this table will likely be associated with a "Clearing Document" and will track whether the physical document has been received, any relevant attributes, and allow for attaching a digital copy of the document.
Clearing File Document
####4.7 TANCIS Details Tab TANCIS Details tab within the Clearing File form. This tab is crucial for recording information related to the Tanzania Customs Integrated System (TANCIS) and other regulatory requirements for your shipments.

#####4.7.1 ** Key Fields **
The TANCIS Details tab typically contains the following key fields:
TANCIS Lodging Date: The date on which the clearing file and related documents were officially lodged into the TANCIS system. This is a critical date for tracking the progress of customs processing.
Reference No: The unique reference number assigned to this clearing file or declaration within the TANCIS system. This number is crucial for all communications and tracking within TANCIS.
TANSAD No: The Tanzania Single Administrative Document (TANSAD) number associated with the customs declaration for this shipment. This is the primary customs declaration document identifier.
Declaration Type: The type of customs declaration being submitted (e.g., IMP for Import, EXP for Export, TRANS for Transit).
CL Plan: This field might refer to a specific Customs Lodging (CL) plan or a similar internal reference code related to the declaration process.
** Note: **
Completing the required fields in this tab (TANCIS Lodging Date, Reference No, TANSAD No, Declaration Type, CL Plan) is a pre-requisite for the system to automatically update the Clearing File status from "Open" to "Pre-Lodged" upon saving.
The TANCIS Lodging Date, Reference No, and TANSAD No are essential for tracking the status of the declaration within the TANCIS system and for communicating with customs authorities.
###5. Creating Related Clearance Processes:
If the "Status" of the Clearing File is "Pre-Lodged" or "On Process," you will see buttons for creating related documents: "TRA Clearance," "Shipping Line Clearance," "Physical Verification," and "Port Clearance."
* Clicking on any of these buttons will:
* Check if a document of that type already exists for the current Clearing File.
* If it exists, you will be redirected to the existing document.
* If it doesn't exist, a new document of that type will be created with pre-filled information such as the linked "Clearing File" and "Customer." The status of the newly created document will be initialized (e.g., "Payment Pending" for TRA Clearance). The status of the Clearing File will also be automatically updated to "On Process" upon the creation of the first related document.
* Fill in the required details in the newly created related document and save it.
###6. Monitoring the Clearing Process:
Track the progress of the clearing process by monitoring the "Status" field in the Clearing File.
Refer to the "Document" table to view all attached documents.
Use the links in the "Clearance Processes" section of the dashboard (within the Clearing File form) to quickly access and manage the related TRA Clearance, Shipping Line Clearance, Physical Verification, and Port Clearance documents. The dashboard provides a count of existing related documents.
7. Completing the Clearing Process:
Once all necessary clearances and processes are completed, and the goods are cleared and potentially delivered, the "Status" of the Clearing File will be updated accordingly (manually or potentially through backend automation based on the status of related documents).
8. Troubleshooting
(Common Errors and Resolutions)
Error: "The following required documents are missing and must be attached before submission: [Document Types]":
- Cause: This error occurs when you try to submit the Clearing File, and one or more mandatory documents (as defined in the "Mode of Transport Detail" linked to the selected "Mode of Transport") are not attached.
- Resolution: Go back to the "Document Section," click "Attach Documents," and attach all the missing document types. Ensure you click "Submit" in the "Attach Clearing Document" dialog for each document.
Error: "No Clearing Charges have been created for this Clearing File. Please create the charges before submitting.":
- Cause: This error occurs during submission if related clearance documents (TRA, Port, Shipping Line, Physical Verification) have total charges greater than zero, but no "Clearing Charges" document is linked to the Clearing File.
- Resolution: Navigate to the "Clearing Charges" doctype, create a new "Clearing Charges" record, link it to the current "Clearing File," and enter the relevant charges.
Error: "Clearing Charges entry for [Charge Type] is missing. Please create the corresponding charge.":
- Cause: This error occurs during submission if a related clearance document has total charges, but there is no corresponding entry for that charge type in the linked "Clearing Charges" document.
- Resolution: Open the linked "Clearing Charges" document and add a new row in the "Charges" table for the missing "Charge Type" (e.g., "TRA Clearance").
Error: "The amount for [Charge Type] does not match the expected value. Expected: [Amount], Found: [Amount].":
- Cause: This error occurs during submission if the amount entered for a specific charge type in the "Clearing Charges" document does not match the "Total Charges" calculated in the corresponding related clearance document.
- Resolution: Review the "Total Charges" in the related clearance document (e.g., TRA Clearance) and update the "Amount" for the corresponding "Charge Type" in the "Clearing Charges" document to match.
Consignee Address not updating automatically:
- Cause: This could be due to an incorrect link in the "Consignee/ Customer" field or if the Customer record does not have a default address set.
- Resolution: Ensure the correct Customer is linked in the "Consignee/ Customer" field. Check the Customer master and ensure a default address is set or that an address is linked to the Customer. Save the Clearing File again to trigger the address fetching.
Related document creation buttons not appearing:
- Cause: The buttons for creating related documents only appear if the "Status" of the Clearing File is "Pre-Lodged" or "On Process."
- Resolution: Ensure the "Status" of the Clearing File is either "Pre-Lodged" or "On Process." If it's "Open," ensure you have saved the Clearing File after filling in the initial details.
If you encounter other errors or issues, please consult the system administrator or refer to the Frappe framework documentation.
9. User Roles and Permissions
Access to and functionality within the Clearing File are controlled by user roles and permissions configured in the Frappe system. Common roles that may interact with the Clearing File include:
- Clearing Officer: Typically has full create, read, write, submit, and cancel permissions for Clearing Files and related documents. They are responsible for managing the end-to-end clearing process.
- Clearing Manager: May have similar permissions to the Clearing Officer with additional rights for reporting and potentially user management within the Clearing module.
- Accounts User: May have read-only access to relevant financial information within the Clearing File and related documents, with permissions to create and manage invoices or payments.
- Warehouse User: May have access to view Clearing File details related to delivery and potentially update delivery statuses.
- System Administrator: Has full access to all aspects of the system, including configuration of user roles, permissions, and customizations.
The specific permissions assigned to each role can be customized based on the organization's requirements. Ensure that users have the appropriate roles assigned to perform their duties effectively.
10. Key Notes
- The "Status" field provides a quick overview of the clearing progress. Keep it updated to reflect the current stage.
- Always attach all relevant documents using the "Attach Documents" functionality to maintain a complete digital record.
- Utilize the related document creation buttons to ensure proper linking between the Clearing File and downstream processes.
- Pay close attention to mandatory document attributes when attaching documents, as these are crucial for compliance and data integrity.
- The backend scripts automate certain aspects of the workflow, such as status updates and mandatory document checks. Understand these automations to ensure smooth processing.
- Ensure that all pre-requisite master data is accurately maintained for the Clearing File to function correctly.
11. What business process pain point does it help remove?
The Clearing File helps remove several critical business process pain points associated with traditional, often manual, clearing operations:
- Disparate Information Sources: Eliminates the need to search through multiple emails, physical files, and spreadsheets to find information related to a specific shipment's clearing process. All relevant data, documents, and linked processes are consolidated in one central record.
- Lack of Real-time Visibility: Provides a clear and up-to-date view of the clearing status, reducing the need for constant follow-ups and status inquiries.
- Manual Data Entry and Errors: Automation of address fetching, cargo description summarization, and linking to related documents reduces manual data entry and the associated risk of errors.
- Inefficient Document Management: Streamlines the process